# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=celt
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.11.3
pkgrel=4
pkgdesc="Low-latency audio communication codec (mingw-w64)"
arch=('any')
url="http://www.celt-codec.org/"
license=("BSD")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-libogg")
options=('strip' 'staticlibs')
source=(https://downloads.xiph.org/releases/${_realname}/${_realname}-${pkgver}.tar.gz)
sha256sums=('7e64815d4a8a009d0280ecd235ebd917da3abdcfd8f7d0812218c085f9480836')

build() {
  export lt_cv_deplibs_check_method='pass_all'

  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-custom-modes \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
